package  
{
	import mx.core.SpriteAsset;
	import mx.core.BitmapAsset;
	import com.bumpslide.ui.Button;
	import com.bumpslide.ui.skin.BasicSkin;
	import com.bumpslide.ui.skin.ISkinnable;

	import flash.display.Bitmap;

	/**
	 * ImageButtonSkin
	 *
	 * @author David Knape
	 * @version SVN: $Id: $
	 */
	public class ImageButtonSkin extends BasicSkin
	{
		
		[Embed(source="button_bg.png",scaleGridTop="5", scaleGridLeft="5", scaleGridRight="35",  scaleGridBottom="17")]
		private var embeddedImage :Class;

		private var background:SpriteAsset;

		
		public function get hostComponent():Button {
			return _hostComponent as Button;
		}

		
		override public function init(host_component:ISkinnable):void
		{
			super.init( host_component );
			background = new embeddedImage() as SpriteAsset;
			addChild( background );
		}

		
		override public function draw(skinState:String):void
		{
			super.draw( skinState );
			
			background.width = hostComponent.width;
			background.height = hostComponent.height;
				
		}
		
		public function _over():void {
			alpha = .8;
		}
		
		public function _off():void {
			alpha = 1.0;
		}
		
		public function _down():void {
			alpha = .8;
		}
		
		public function _disabled():void {
			alpha = .5;
		}
		
		
		
		
	}
}
